/* File: matched_analysis_paper_graphs.do
 * Author: Luca Maini
 * Purpose: this file plots some raw data graphs
 * Output: Figures 3-7
 *
 */


graph set window fontface "${OAFont}"

use "${coeffdir}\coefficients_sales_final_noatc3.dta", replace
drop if valeant_ind == 1	// excluded from main analysis

* Calculate number of matched units
count if acquired == 1
forvalues i = 1/5 {
	count if acquired == 1 & cem_varlist == `i'
	}
 

////////////////////////////////////////////////
////										////
////	SECTION 4. Horizontal acquisitions	////
////										////
////////////////////////////////////////////////

* Effect of horizontal acquisitions on net price
twoway 	(kdensity b_w_log_net_b if placebo == 1, ///
			lwidth(*2.5) lpattern(dot) lcolor(gs0)) ///
		(kdensity b_w_log_net_b if overlap == 1, ///
			lwidth(*2) lpattern(solid) lcolor(gs0)) ///
		, ///
	ylabel(0(0.4)1.2, nogrid format(%4.1f)) ytitle("{bf:Density}") ///
	xlabel(#8) xtitle("{bf:Effect on log net price}", height(6)) ///
	legend(order(2 "Horizontal" "acquisitions" 1 "Placebo") cols(1) ///
		   ring(0) bplacement(11) region(color(none)))
graph export "${paperdir}\Figures\Figure OA7b.pdf", as(pdf) replace

* distribution values to be reported in the text
sum b_w_log_net_b if overlap == 1, d
disp exp(r(mean))
sum b_w_log_net_b if placebo == 1, d

* Split effect (HSR) of horizontal acquisitions on net price
twoway 	(kdensity b_w_log_net_b if placebo == 1, ///
			lwidth(*2.5) lpattern(dot) lcolor(gs0)) ///
		(kdensity b_w_log_net_b if overlap_nonstealth == 1, ///
			lwidth(*2) lpattern(dash) lcolor(gs0)) ///
		(kdensity b_w_log_net_b if overlap_stealth == 1, ///
			lwidth(*2) lpattern(solid) lcolor(gs0)) ///
		, ///
	ylabel(0(0.4)1.2, nogrid format(%4.1f)) ytitle("{bf:Density}") ///
	xlabel(#8) xtitle("{bf:Effect on log net price}", height(6)) ///
	legend(order(2 "Horizontal acquisitions" "above HSR threshold" ///
				 3 "Horizontal acquisitions" "below HSR threshold" ///
				 1 "Placebo") cols(1) ///
		   ring(0) bplacement(11) region(color(none)))
graph export "${paperdir}\Figures\Figure OA8b.pdf", as(pdf) replace

sum b_w_log_net_b if overlap_nonstealth == 1, d
sum b_w_log_net_b if overlap_stealth == 1, d
sum b_w_log_net_b if placebo == 1, d


////////////////////////////////////////////
////									////
////	SECTION 5. Portfolio analysis 	////
////									////
////////////////////////////////////////////

* Effect of cross-market acquisitions by larger company on net price
twoway 	(kdensity b_w_log_net_b if placebo == 1, ///
			lwidth(*2.5) lpattern(dot) lcolor(gs0)) ///
		(kdensity b_w_log_net_b if lg_acq == 1 & overlap == 0, ///
			lwidth(*2) lpattern(solid) lcolor(gs0)) ///
		, ///
	ylabel(0(0.4)1.2, nogrid format(%4.1f)) ytitle("{bf:Density}") ///
	xlabel(#8) xtitle("{bf:Effect on log net price}", height(6)) ///
	legend(order(2 "Cross-mkt. acquisitions" "by larger companies" 1 "Placebo") cols(1) ///
		   ring(0) bplacement(11) region(color(none)))
graph export "${paperdir}\Figures\Figure OA10b.pdf", as(pdf) replace


*** END CODE
